package com.atguigu.lease.web.app.custom.config;

import com.atguigu.lease.web.app.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Value("${login.interceptors.includes}")
    private String includes;
    @Value("${login.interceptors.excludes}")
    private String excludes;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(includes)
                .excludePathPatterns(excludes).order(7);
    }
}
